Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support Pandas future.infer_string=True in report generation #1674

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ssiegel
Copy link

@ssiegel ssiegel commented Nov 7, 2024

Previously, report generation encountered issues when future.infer_string=True was set. This resulted in multiple warnings ("FutureWarning: Dtype inference on a pandas object is deprecated") and failures when string columns contained only empty strings ("AttributeError: 'StringDtype' object has no attribute 'pyarrow_dtype'").
This change resolves the issue by explicitly setting the dtype to "object" for the relevant operations.

@ssiegel ssiegel changed the title Support Pandas future.infer_string=True in report generation fix: Support Pandas future.infer_string=True in report generation Nov 7, 2024
@ssiegel ssiegel force-pushed the fix-pd-future-infer-string branch from 0364724 to d65a768 Compare November 10, 2024 17:19
@fabclmnt fabclmnt self-requested a review January 20, 2025 16:24
Previously, report generation encountered issues when
`future.infer_string=True` was set. This resulted in multiple warnings
("FutureWarning: Dtype inference on a pandas object is deprecated") and
failures when string columns contained only empty strings
("AttributeError: 'StringDtype' object has no attribute
'pyarrow_dtype'").
This change resolves the issue by explicitly setting the dtype to
"object" for the relevant operations.
@fabclmnt fabclmnt force-pushed the fix-pd-future-infer-string branch from 40829e8 to 37cc39f Compare January 29, 2025 21:34
@fabclmnt
Copy link
Contributor

@ssiegel thank you for your contribution. It seems like your contributions failed to pass the tests.

Can you please review it?

- Introduce the `optional_option_context` helper to replace the direct
  use of `pd.option_context("future.no_silent_downcasting", True)`,
  ensuring compatibility with older pandas versions that lack this
  option.
- Update the `future.infer_string` test to run only on pandas >= 2.1,
  where it is applicable.
@ssiegel
Copy link
Author

ssiegel commented Feb 1, 2025

I have no idea what the failing "Pull Request / Lint commit message (pull_request)" and "Pull Request / Lint source code (pull_request)" tests are about. The error messages don't look like they are related to anything I touched.

N.B. A lot of tests were failing when I tested locally with pandas<1.3. The corresponding line in requirements.txt might be out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants